import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: () => import('@/views/Home.vue'),
      redirect: '/goods',
      children: [
        {
          path: '/goods',
          name: 'goods',
          component: () => import('@/views/Goods.vue'),
          meta: {
            isShow: true,
            title: '商品管理',
          },
        },
        {
          path: '/users',
          name: 'users',
          component: () => import('@/views/Users.vue'),
          meta: {
            isShow: true,
            title: '用户管理',
          },
        },
      ],
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('@/views/Login.vue'),
    },
  ],
})

export default router
